package com.minimalist.common.entity.lindi.vo.purchaseapplication;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.entity.lindi.vo.purchaseapplicationfile.LindiPurchaseApplicationFileVO;
import com.minimalist.common.entity.lindi.vo.purchaseapplicationprojectitem.LindiPurchaseApplicationProjectItemVO;
import com.minimalist.common.entity.lindi.vo.purchaseapplicationtownitem.LindiPurchaseApplicationTownItemVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

/**
 * 林地指标交易平台_指标购买申请表 VO类。
 *
 * @author 11987
 * @since 2025-07-01
 */
@Schema(description = "林地指标交易平台_指标购买申请表")
public class LindiPurchaseApplicationVO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    // ========== 基本信息 ==========

    @NotNull(message = "购买申请ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "购买申请ID")
    private Long purchaseApplicationId;

    @NotBlank(message = "购买申请编号不能为空", groups = {Add.class, Update.class})
    @Schema(description = "购买申请编号")
    private String purchaseApplicationCode;

    @NotBlank(message = "购买申请名称不能为空", groups = {Add.class, Update.class})
    @Schema(description = "购买申请名称")
    private String purchaseApplicationName;

    @Schema(description = "购买申请状态")
    private String purchaseApplicationStatus;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(description = "申请时间")
    private LocalDateTime applicationTime;

    // ========== 关联信息 ==========

    @Schema(description = "购买申请文件列表")
    private List<LindiPurchaseApplicationFileVO> fileList;

    @Schema(description = "购买申请项目指标列表")
    private List<LindiPurchaseApplicationProjectItemVO> projectItemList;

    @Schema(description = "购买申请乡镇指标列表")
    private List<LindiPurchaseApplicationTownItemVO> townItemList;

    // ========== 审计字段 ==========

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "创建人ID")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "更新人ID")
    private Long updateId;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    // Getter和Setter方法
    public Long getPurchaseApplicationId() {
        return purchaseApplicationId;
    }

    public void setPurchaseApplicationId(Long purchaseApplicationId) {
        this.purchaseApplicationId = purchaseApplicationId;
    }

    public String getPurchaseApplicationCode() {
        return purchaseApplicationCode;
    }

    public void setPurchaseApplicationCode(String purchaseApplicationCode) {
        this.purchaseApplicationCode = purchaseApplicationCode;
    }

    public String getPurchaseApplicationName() {
        return purchaseApplicationName;
    }

    public void setPurchaseApplicationName(String purchaseApplicationName) {
        this.purchaseApplicationName = purchaseApplicationName;
    }

    public String getPurchaseApplicationStatus() {
        return purchaseApplicationStatus;
    }

    public void setPurchaseApplicationStatus(String purchaseApplicationStatus) {
        this.purchaseApplicationStatus = purchaseApplicationStatus;
    }

    public LocalDateTime getApplicationTime() {
        return applicationTime;
    }

    public void setApplicationTime(LocalDateTime applicationTime) {
        this.applicationTime = applicationTime;
    }

    public List<LindiPurchaseApplicationFileVO> getFileList() {
        return fileList;
    }

    public void setFileList(List<LindiPurchaseApplicationFileVO> fileList) {
        this.fileList = fileList;
    }

    public List<LindiPurchaseApplicationProjectItemVO> getProjectItemList() {
        return projectItemList;
    }

    public void setProjectItemList(List<LindiPurchaseApplicationProjectItemVO> projectItemList) {
        this.projectItemList = projectItemList;
    }

    public List<LindiPurchaseApplicationTownItemVO> getTownItemList() {
        return townItemList;
    }

    public void setTownItemList(List<LindiPurchaseApplicationTownItemVO> townItemList) {
        this.townItemList = townItemList;
    }

    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }

    public Long getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Long updateId) {
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        LindiPurchaseApplicationVO that = (LindiPurchaseApplicationVO) o;
        return Objects.equals(purchaseApplicationId, that.purchaseApplicationId)
                && Objects.equals(purchaseApplicationCode, that.purchaseApplicationCode)
                && Objects.equals(purchaseApplicationName, that.purchaseApplicationName)
                && Objects.equals(purchaseApplicationStatus, that.purchaseApplicationStatus)
                && Objects.equals(applicationTime, that.applicationTime)
                && Objects.equals(fileList, that.fileList)
                && Objects.equals(projectItemList, that.projectItemList)
                && Objects.equals(townItemList, that.townItemList)
                && Objects.equals(createId, that.createId)
                && Objects.equals(updateId, that.updateId)
                && Objects.equals(createTime, that.createTime)
                && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(purchaseApplicationId, purchaseApplicationCode, purchaseApplicationName, purchaseApplicationStatus, applicationTime, fileList, projectItemList, townItemList, createId, updateId, createTime, updateTime);
    }
}